{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 第 9 章 数据的决策分析及可视化"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.1 确定性分析"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　9.1.1 单目标求解及图示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（1）读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>设备投资</th>\n",
       "      <th>单件成本</th>\n",
       "      <th>年销售量</th>\n",
       "      <th>销售单价</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>1500000</td>\n",
       "      <td>1700</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>2000000</td>\n",
       "      <td>1550</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>2500000</td>\n",
       "      <td>1400</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        设备投资  单件成本  年销售量  销售单价\n",
       "方案                            \n",
       "方案1  1500000  1700  8000  2900\n",
       "方案2  2000000  1550  8000  2900\n",
       "方案3  2500000  1400  8000  2900"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "Tv=pd.read_excel('DaPy_data.xlsx','Target',index_col=0); Tv #目标值 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（2）计算年收益金额"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>设备投资</th>\n",
       "      <th>单件成本</th>\n",
       "      <th>年销售量</th>\n",
       "      <th>销售单价</th>\n",
       "      <th>年收益</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>1500000</td>\n",
       "      <td>1700</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "      <td>8100000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>2000000</td>\n",
       "      <td>1550</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "      <td>8800000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>2500000</td>\n",
       "      <td>1400</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "      <td>9500000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        设备投资  单件成本  年销售量  销售单价      年收益\n",
       "方案                                     \n",
       "方案1  1500000  1700  8000  2900  8100000\n",
       "方案2  2000000  1550  8000  2900  8800000\n",
       "方案3  2500000  1400  8000  2900  9500000"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Tv['年收益']=Tv.年销售量*(Tv.销售单价-Tv.单件成本)-Tv.设备投资;Tv "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（3）年收益的直观分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWkAAAEfCAYAAACDADeSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAANTUlEQVR4nO3df7DldV3H8ecLFotfssBeQUpZKWIqyRivEEQMWDsjZuiQiA0/0szVRnLGP2pgbKihmSz74UwK1ioZRZpajGRqjkNuUJDOJSZsSsofwFitXPm1i/4h0Ls/zr3s3XX3nrNwzz3vc+/zMcPsPef7XXgPn8uT736/3/O9qSokST0dNOkBJEn7Z6QlqTEjLUmNGWlJasxIS1JjRlqSGhtLpJMcl+S2Efb7mySnjWMGSVoLVjzSSY4GbgAOH7LfJcBXququlZ5BktaKcRxJPwlcDOyEp46qP5Xk9iRXLbx3DPD7wMNJzhvDDJK0Jqx4pKtqZ1U9uuStq4APV9VZwKuSHAu8Dfgo8MfA5UkuW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>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt            \n",
    "plt.rcParams['font.sans-serif']=['SimHei']; \n",
    "#plt.rcParams['figure.dpi']=90  #分辨率\n",
    "Tv['年收益'].plot(kind='bar');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（4）确定最佳方案：收益率最大者为最佳方案。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案3'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Tv['年收益'].idxmax()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　9.1.2 多目标求解及图示"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（1）计算理想值:      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1500000, 1400, 8000, 2900, 9500000]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Ev=[min(Tv.设备投资), min(Tv.单件成本), max(Tv.年销售量), max(Tv.销售单价), \n",
    "    max(Tv.年收益)]; Ev #理想值 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（2）计算差距: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>设备投资</th>\n",
       "      <th>单件成本</th>\n",
       "      <th>年销售量</th>\n",
       "      <th>销售单价</th>\n",
       "      <th>年收益</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>0</td>\n",
       "      <td>90000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1960000000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>250000000000</td>\n",
       "      <td>22500</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>490000000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>1000000000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              设备投资   单件成本  年销售量  销售单价            年收益\n",
       "方案                                                  \n",
       "方案1              0  90000     0     0  1960000000000\n",
       "方案2   250000000000  22500     0     0   490000000000\n",
       "方案3  1000000000000      0     0     0              0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Tv_Ev2=((Tv-Ev))**2    #差值的平方 \n",
    "Tv_Ev2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "方案\n",
       "方案1    1960000090000\n",
       "方案2     740000022500\n",
       "方案3    1000000000000\n",
       "dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Dv=(Tv_Ev2).sum(1); Dv   #差距"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>设备投资</th>\n",
       "      <th>单件成本</th>\n",
       "      <th>年销售量</th>\n",
       "      <th>销售单价</th>\n",
       "      <th>年收益</th>\n",
       "      <th>差距</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>1500000</td>\n",
       "      <td>1700</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "      <td>8100000</td>\n",
       "      <td>1960000090000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>2000000</td>\n",
       "      <td>1550</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "      <td>8800000</td>\n",
       "      <td>740000022500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>2500000</td>\n",
       "      <td>1400</td>\n",
       "      <td>8000</td>\n",
       "      <td>2900</td>\n",
       "      <td>9500000</td>\n",
       "      <td>1000000000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        设备投资  单件成本  年销售量  销售单价      年收益             差距\n",
       "方案                                                    \n",
       "方案1  1500000  1700  8000  2900  8100000  1960000090000\n",
       "方案2  2000000  1550  8000  2900  8800000   740000022500\n",
       "方案3  2500000  1400  8000  2900  9500000  1000000000000"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Tv['差距']=Dv; Tv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（3）差距的直观分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAEfCAYAAABLbN1EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAT9UlEQVR4nO3df5BlZX3n8feHGd2FQQGhM8uwixOTMYYKTFm2ApNRW9YpBC0TSAnuqvmhlTEx7s/KbmSh4sJqRUmVVAoi7mxRu4RVKiYxuBtDUeowYeKMxp5dBSxhLTcjBYq0CjRstiKQ7/5xD07T29339Ex33+6n36+qW/ec5zyn+1s8zYfDc557T6oKSVJ7jht1AZKk5WHAS1KjDHhJapQBL0mNMuAlqVEGvCQ1atUFfJLNSfYP6fPTST49Y//lSb6Q5K4k71/+KiVp9VtVAZ/kFOBmYNMCfX4C+F3gpBnNvwZcUlWvAS5LctKcJ0vSOrKqAh54BrgcmIYfXc3fnuRAkiu6Pk8AvzDzpKp6d1U9kuR5wEbgb1ayaElajVZVwFfVdFU9PqPpCuAPq2oH8PNJTq2qR6rqb+f5Ef8a+ERVPbXsxUrSKrdx1AUM8VPA+Ul+mcG0zRbg+3N1THIucDHw+hWrTpJWsdUe8PcDn66qO5O8HfjBXJ2SbAU+CrzZq3dJGlhVUzRz+BDwm0m+ALwB+O48/T4MvAj4eJJ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4BHquqRUdelfhy/tc3xG3AVzTKpqkry7PfQ/HcGy7NOA/4ecENV/efRVadhHL+1zfEbMOBXxoNV9WaAJC9kcONnXfyBNcLxW9vW7fgZ8MsgyY8BZ811rKqmkxxc4ZK0CI7f2ub4HeEqmuXxX4HTZuw/50ZHVf3GypajRXL81jbHr+NN1mWU5HHgHuDHGTyE4Dbg5qp6ZpR1qR/Hb21z/LyCX253V9XOqjoDeDdwJvCFJGMjrkv9OH5r27ofPwN+mSTZwIx/vlX1nar698C/Av64W6erVcrxW9scvwGnaJZJ9we0q6rumOPYmVX1wAjKUk+O39rm+A0Y8JLUqHXxvymStB4Z8NIM3Ufch/U5eQVKkY6ZUzTSDEk+C7yjqh6e1f4SBo98A/g3wF8Af9XtP1FV31y5KqV+vILXupZkQ5KZn+jeA/z0jOPHdSsyrgO2MXiQxFPAI8DW7nX9StUrLYZfVaD1bhfw290XU50D3A0wY6bmOOD9DEL9XcBPAE8C/wDYwOA7xr+/siVL/ThFI3WSHKiqHQscfy/wOuDDwBMMgv9Xq+qJFSpRWhQDXuok+Tbwv2c0/UPgzVV1d5J/BJwKvAZ4L/AA8DfAQeBTVXX/StcrDeMUjQQk2QL8j6p604y2P2Mw1w6DKZkfZ/Dw5l8D/g+Dm6znAjuS/K/yakmrjAEvDbybwZdRzXQqRwL+P3TvJzO40fo0gy+wmgaeB3wa+MFyFykthgGvdS/J+cBFwM/OaHsh8Per6tmnAv08cClwMfAHDP7dORv4EvDpqjLcteq4TFLrWpIXA9cymGt/qmv7KHAX8Pvd/tnAzcDjVfV2BqtmHq2qX2UwF39dkleNon5pId5k1bqXZGNVPT3qOqSlZsBLUqOcopGkRhnwktQoA16SGmXAS1KjDHhJatT/A3r9YjEww1nXAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "Dv.plot(kind='bar');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "（4）确定最佳方案: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案2'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Dv.idxmin() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>单目标</th>\n",
       "      <th>单目标方案</th>\n",
       "      <th>多目标</th>\n",
       "      <th>多目标方案</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>8100000</td>\n",
       "      <td>False</td>\n",
       "      <td>1960000090000</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>8800000</td>\n",
       "      <td>False</td>\n",
       "      <td>740000022500</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>9500000</td>\n",
       "      <td>True</td>\n",
       "      <td>1000000000000</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         单目标  单目标方案            多目标  多目标方案\n",
       "方案                                       \n",
       "方案1  8100000  False  1960000090000  False\n",
       "方案2  8800000  False   740000022500   True\n",
       "方案3  9500000   True  1000000000000  False"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.DataFrame({'单目标':Tv['年收益'],'单目标方案':Tv['年收益']==Tv['年收益'].max(),\n",
    "              '多目标':Tv['差距'],'多目标方案':Tv['差距']==Tv['差距'].min()})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.2 不确定性决策分析"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　9.2.1 分析方法简介"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>畅销</th>\n",
       "      <th>一般</th>\n",
       "      <th>滞销</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>12900000</td>\n",
       "      <td>8100000</td>\n",
       "      <td>300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>14200000</td>\n",
       "      <td>8800000</td>\n",
       "      <td>25000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>15500000</td>\n",
       "      <td>9500000</td>\n",
       "      <td>-250000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           畅销       一般      滞销\n",
       "方案                            \n",
       "方案1  12900000  8100000  300000\n",
       "方案2  14200000  8800000   25000\n",
       "方案3  15500000  9500000 -250000"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PLm=pd.DataFrame();    #构建损益矩阵 ProfitLoss matrix \n",
    "PLm['畅销']= 12000*(Tv.销售单价-Tv.单件成本)-Tv.设备投资; \n",
    "PLm['一般']= 8000*(Tv.销售单价-Tv.单件成本)-Tv.设备投资; \n",
    "PLm['滞销']= 1500*(Tv.销售单价-Tv.单件成本)-Tv.设备投资;\n",
    "PLm "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　9.2.2  不确定分析原则"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "9.2.2.1 乐观原则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "方案\n",
       "方案1    12900000\n",
       "方案2    14200000\n",
       "方案3    15500000\n",
       "dtype: int64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lg=PLm.max(axis=1);lg  #每列最大者"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>畅销</th>\n",
       "      <th>一般</th>\n",
       "      <th>滞销</th>\n",
       "      <th>乐观</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>12900000</td>\n",
       "      <td>8100000</td>\n",
       "      <td>300000</td>\n",
       "      <td>12900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>14200000</td>\n",
       "      <td>8800000</td>\n",
       "      <td>25000</td>\n",
       "      <td>14200000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>15500000</td>\n",
       "      <td>9500000</td>\n",
       "      <td>-250000</td>\n",
       "      <td>15500000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           畅销       一般      滞销        乐观\n",
       "方案                                      \n",
       "方案1  12900000  8100000  300000  12900000\n",
       "方案2  14200000  8800000   25000  14200000\n",
       "方案3  15500000  9500000 -250000  15500000"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BQD=PLm.copy();PLm\n",
    "BQD['乐观']=lg; BQD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAEfCAYAAACzjCazAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAARkElEQVR4nO3dfZBdd13H8fenSdGSFFraJRAFSjUwIliQpdiY1rSSkSICU4HWgaK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u7HLtZhrkkNWDd/BNEklpmmGvdGl4KPqrmpGPQinTEnGbRupXkY8DFVXVo3vrTGTx6DOB3gX8GPjN8f3NVfe3YdSl145651o0kG5LMvep5D/Azc7YfNzw74vXANgYPPrgV+C5w2vDPG45Vv9JyeDm/1pNdwCuGN2b6OeBzAHNmW44DXskgwJ8N/BRwC3AfYAOD+2R//9i2LHXjNIvWpSQHqmr7EtsvAc4F/hi4mUHIP6eqbj5GLUrLYphrXUrybeDrc1b9JPCEqvpckvsBpwDnAJcA3wT+B/gU8L6q+vKx7lcaxWkWrTtJtgL/VlWPn7PugwzmxmEwrfJABg8Hfh7wQwYHQB8NbE/yn+VekFYZw1zr0XMZ3IxprlOYDfM/HL6exOAg6G0MbuA0AxwPvB/4wdFuUloOw1zrSpKzgPOBX5yz7h7Aj1fVHU+seRJwAfA44K8Z/D15GPBp4P1VZZBr1fHURK0bSR4AXMlgbvzW4bo3A9cCbxq+fxhwNXBTVT2dwdkrh6vqOQzmzl+f5Mxx9C8txQOgWleSbKyq28bdh9Q3w1ySGuA0iyQ1wDCXpAYY5pLUAMNckhpgmEtSA/4fXlo/AblSS8kAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "lg.plot(kind='bar');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案3'"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lg.idxmax() "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "9.2.2.2 悲观原则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "方案\n",
       "方案1    300000\n",
       "方案2     25000\n",
       "方案3   -250000\n",
       "dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bg=PLm.min(1); bg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>畅销</th>\n",
       "      <th>一般</th>\n",
       "      <th>滞销</th>\n",
       "      <th>乐观</th>\n",
       "      <th>悲观</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>12900000</td>\n",
       "      <td>8100000</td>\n",
       "      <td>300000</td>\n",
       "      <td>12900000</td>\n",
       "      <td>300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>14200000</td>\n",
       "      <td>8800000</td>\n",
       "      <td>25000</td>\n",
       "      <td>14200000</td>\n",
       "      <td>25000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>15500000</td>\n",
       "      <td>9500000</td>\n",
       "      <td>-250000</td>\n",
       "      <td>15500000</td>\n",
       "      <td>-250000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           畅销       一般      滞销        乐观      悲观\n",
       "方案                                              \n",
       "方案1  12900000  8100000  300000  12900000  300000\n",
       "方案2  14200000  8800000   25000  14200000   25000\n",
       "方案3  15500000  9500000 -250000  15500000 -250000"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BQD['悲观']=bg; BQD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEVCAYAAAALsCk2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPKElEQVR4nO3df6zdd13H8edrLdPSbuxHr5WqpSDTiGCzcBlbLUuHNKGwoBkZQweoIJ0RMOEPFbIFDcY4NQETZAs1C1aNhqow4sayTAauWbeZW41AYnRBO2QIK9D1rvqH23z7xznknvZTeu8999zzPaf3+Uhu7ve8v6f3vr953/bVz/f7PeemqpAkadB5XTcgSZo8hoMkqWE4SJIahoMkqWE4SJIahoMkqbG+6wZGYfPmzbV9+/au25CkqXLkyJFvVtXMmfadE+Gwfft25ubmum5DkqZKkse+2z5PK0mSGoaDJKlhOEiSGoaDJKkxdDgkuSTJniSbR9mQJKl7Q4VDkucDdwNXAJ9LMpPkjiSHk9wy8LyR1iRJ4zHsyuHHgfdW1e8A9wKvBtZV1U5ga5LLklw3ytpKD1SStHRDvc6hqv4OIMnV9FYPlwAH+7vvB3YBl4+49ugwvUqSlm/oF8ElCXAD8DQQ4PH+rnngxcDGEddO//77gH0A27ZtG/YwhrL9fXeP9fuN29FbX991C5I6NvQF6ep5F3AYuBLY0N+1qf91T464dvr3319Vs1U1OzNzxld/S5KGNOwF6d9I8rb+w4uAW+md+gHYARwFjoy4Jkkak2FPK+0HDib5JeBLwJ3AA0m2AnvprSQKODTCmiRpTIZaOVTV8araU1VXV9WvVNUJYDfwMHBNVZ2oqvlR1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9C5KP0PvDd3mgecAnwa+vdpNSsthOEgrkOQqYC/wkwO1C4Hvrarv/EaxnwGuA14H/Cm9v3cvAx4BPl1VBoMmjreySkNK8gLg9+ldW3i6X7sNeAD4aP/xy4ADwImqegu9u5OOV9U76V17+HCSK7roXzobL0hLK5BkfVU903Uf0qgZDpKkhqeVJEkNw0GS1DAcJEkNw0GS1DAcJEmN/wc0pH4G/sx2owAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.rcParams['axes.unicode_minus']=False;  #正常显示图中负号\n",
    "bg.plot(kind='bar');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案1'"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bg.idxmax() "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "9.2.2.3 折中原则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "方案\n",
       "方案1    4710000.0\n",
       "方案2    4986250.0\n",
       "方案3    5262500.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=0.35 \n",
    "zz= a*lg + (1-a)*bg; zz"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>畅销</th>\n",
       "      <th>一般</th>\n",
       "      <th>滞销</th>\n",
       "      <th>乐观</th>\n",
       "      <th>悲观</th>\n",
       "      <th>折中</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>12900000</td>\n",
       "      <td>8100000</td>\n",
       "      <td>300000</td>\n",
       "      <td>12900000</td>\n",
       "      <td>300000</td>\n",
       "      <td>4710000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>14200000</td>\n",
       "      <td>8800000</td>\n",
       "      <td>25000</td>\n",
       "      <td>14200000</td>\n",
       "      <td>25000</td>\n",
       "      <td>4986250.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>15500000</td>\n",
       "      <td>9500000</td>\n",
       "      <td>-250000</td>\n",
       "      <td>15500000</td>\n",
       "      <td>-250000</td>\n",
       "      <td>5262500.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           畅销       一般      滞销        乐观      悲观         折中\n",
       "方案                                                         \n",
       "方案1  12900000  8100000  300000  12900000  300000  4710000.0\n",
       "方案2  14200000  8800000   25000  14200000   25000  4986250.0\n",
       "方案3  15500000  9500000 -250000  15500000 -250000  5262500.0"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BQD['折中']=zz; BQD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw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14H6vn8Lgxy8B/CLw98A/DZ8/VlWfXbkppfG4J62Zl2RdksV3z24DvnvR9sOGVwq8BTiVwYfJPwE8BGwa/nrrSs0rHQpvC9dqsBm4fvhhPC8B7gNYdNTjMOBXGIT59cB3AI8DLwDWMfiM4q+u7MjSeDzcoVUlyV1VdfYS268Gzgd+E3iMQbzfUFWPrdCI0iEx0lpVkvwX8LlFL30bcHFV3Zfk24HjgHOBq4EHgK8DdwM3V9X9Kz2vNIqHO7RqJDkR+JequmjRa3/F4NgzDA5vvJDBDzT9OeBrDE4cvhw4O8m/lXstasZIazV5I4MP4FnsOPZG+teGXzcwOHn4JIMP7dkNfBNwC/DwpIeUDoWR1qqQ5CzgAuAHFr32POBbqmrPT/d4NXAJcCHwxwy+/08DPgHcUlUGWu14CZ5mXpKTgd9icOz5ieFrbwd2ADcOn58G3AQ8WlWXM7ia45GqegODY9NvSXLmNOaXluKJQ60KSdZX1ZPTnkNabkZakhrzcIckNWakJakxIy1JjRlpSWrMSEtSY/8HxozIttFwDSQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "zz.plot(kind='bar');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案3'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zz.idxmax() "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "9.2.2.4 后悔原则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>畅销</th>\n",
       "      <th>一般</th>\n",
       "      <th>滞销</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>2600000</td>\n",
       "      <td>1400000</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>1300000</td>\n",
       "      <td>700000</td>\n",
       "      <td>275000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>550000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          畅销       一般      滞销\n",
       "方案                           \n",
       "方案1  2600000  1400000       0\n",
       "方案2  1300000   700000  275000\n",
       "方案3        0        0  550000"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Rm=PLm.max()-PLm;Rm  #构建后悔矩阵 Regret matrix "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "方案\n",
       "方案1    2600000\n",
       "方案2    1300000\n",
       "方案3     550000\n",
       "dtype: int64"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hh=Rm.max(1);hh "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>畅销</th>\n",
       "      <th>一般</th>\n",
       "      <th>滞销</th>\n",
       "      <th>乐观</th>\n",
       "      <th>悲观</th>\n",
       "      <th>折中</th>\n",
       "      <th>后悔</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>12900000</td>\n",
       "      <td>8100000</td>\n",
       "      <td>300000</td>\n",
       "      <td>12900000</td>\n",
       "      <td>300000</td>\n",
       "      <td>4710000.0</td>\n",
       "      <td>2600000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>14200000</td>\n",
       "      <td>8800000</td>\n",
       "      <td>25000</td>\n",
       "      <td>14200000</td>\n",
       "      <td>25000</td>\n",
       "      <td>4986250.0</td>\n",
       "      <td>1300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>15500000</td>\n",
       "      <td>9500000</td>\n",
       "      <td>-250000</td>\n",
       "      <td>15500000</td>\n",
       "      <td>-250000</td>\n",
       "      <td>5262500.0</td>\n",
       "      <td>550000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           畅销       一般      滞销        乐观      悲观         折中       后悔\n",
       "方案                                                                  \n",
       "方案1  12900000  8100000  300000  12900000  300000  4710000.0  2600000\n",
       "方案2  14200000  8800000   25000  14200000   25000  4986250.0  1300000\n",
       "方案3  15500000  9500000 -250000  15500000 -250000  5262500.0   550000"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "BQD['后悔']=hh; BQD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAEfCAYAAACzjCazAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPvElEQVR4nO3df7DldV3H8eeLXSxcEJC9rq6Vq7VajLLjeFVYN12tnQQdE0qxwV/puPZDm/GPGhkYK7LJbNKZ/EFtMUaUJpahieSoQJCL5t1MoAkydXFEkasCF/IPgd79cY7u9XbvPd+9e/Z+7/nc52Pmzj33nM/dfcPn8pwv3+8556aqkCRNtmP6HkCSdOSMuSQ1wJhLUgOMuSQ1wJhLUgOMuSQ1oNeYJ9mS5PoO6z6c5MmrMZMkTaLeYp7kZOBSYNOIdecBX6qqz63KYJI0gfo8Mn8QOBeYg+8fpV+VZH+S84f3PRz4Y+CuJM/ub1RJWtt6i3lVzVXVPfPuOh94f1XtBF6Y5BTgDcAHgD8DXp7kBT2MKklr3lq6APoE4FeTXMvg1MtW4MnAu6rqDuByYHdv00nSGrax7wHmuRX4UFVdk+SlwLeB/wYeB9wCTAO39TifJK1Z6fuNtpJcW1W7kzwSuAQ4Cfgy8ErgEcBfACcC3wHOqap7expVktas3mMuSTpya+mcuSRphYy5JDWglwugmzdvrm3btvXxV0vSxDpw4MA3q2pqscd6ifm2bduYmZnp46+WpImVZMln9HmaRZIaYMwlqQHGXJIaYMwlqQHGXJIaYMwlqQHGXJIaYMwlqQFr6S1wj5pt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9YrXmlw+HL+bWe7AHeNHxTptOAGwHmnW05BvhtBgF/NfDjwH3AI4ENDN4j+1urO7LUjadZtC4l2V9VO5d5/HXAs4E/BO5lEPnXVNW9qzSidFiMudalJF8DvjTvrh8BXlBVNyb5UeAU4JnA64CvAN8BbgA+WFW3rva80iieZtG6k2Qr8G9V9fx5932EwblxGJxWeSyDXwz8K8D/MLgA+nRgZ5L/Ko+CtMYYc61Hr2XwRkzzncKhmP/e8PNJDC6CPsDgzZvmgGOBDwHfPtpDSofDmGtdSXIGcCbwjHn3PQz44ar63m+reSFwDnAW8FcM/jt5EvAZ4ENVZci15vjURK0bSR4DvJXBufH7h/e9G7gOeNfw6ycBlwL3VNVLGTx75a6qeg2Dc+dvT/K0PuaXluMFUK0rSTZW1QN9zyGNmzGXpAZ4mkWSGmDMJakBxlySGmDMJakBxlySGvB/vOmmpTWgyT8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "hh.plot(kind='bar');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案3'"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hh.idxmin() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>乐观</th>\n",
       "      <th>乐观方案</th>\n",
       "      <th>悲观</th>\n",
       "      <th>悲观方案</th>\n",
       "      <th>折中</th>\n",
       "      <th>折中方案</th>\n",
       "      <th>后悔</th>\n",
       "      <th>后悔方案</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>12900000</td>\n",
       "      <td>False</td>\n",
       "      <td>300000</td>\n",
       "      <td>True</td>\n",
       "      <td>4710000.0</td>\n",
       "      <td>False</td>\n",
       "      <td>2600000</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>14200000</td>\n",
       "      <td>False</td>\n",
       "      <td>25000</td>\n",
       "      <td>False</td>\n",
       "      <td>4986250.0</td>\n",
       "      <td>False</td>\n",
       "      <td>1300000</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>15500000</td>\n",
       "      <td>True</td>\n",
       "      <td>-250000</td>\n",
       "      <td>False</td>\n",
       "      <td>5262500.0</td>\n",
       "      <td>True</td>\n",
       "      <td>550000</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           乐观   乐观方案      悲观   悲观方案         折中   折中方案       后悔   后悔方案\n",
       "方案                                                                   \n",
       "方案1  12900000  False  300000   True  4710000.0  False  2600000  False\n",
       "方案2  14200000  False   25000  False  4986250.0  False  1300000  False\n",
       "方案3  15500000   True -250000  False  5262500.0   True   550000   True"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.DataFrame({'乐观':lg,'乐观方案':lg==lg.max(),'悲观':bg,'悲观方案':bg==bg.max(),\n",
    "              '折中':zz,'折中方案':zz==zz.max(),'后悔':hh,'后悔方案':hh==hh.min()})"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 9.3  概率型风险分析"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　9.3.1 期望值法及直观分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "方案\n",
       "方案1    6630000.0\n",
       "方案2    7146250.0\n",
       "方案3    7662500.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "probE=[0.1,0.65,0.25]; #初始概率 \n",
    "qw=(probE*PLm).sum(1); qw"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWkAAAEfCAYAAACDADeSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAPA0lEQVR4nO3df7DldV3H8eeLXS1FdIE98sNEpMgpRSOvKIS0WDv5g1BJXBuFNHPVwZzhj1KysYZmssxyJkPqqhlJklqMaGqmxrYYiF1yRKe0/IGMJXJVlkX9Q6B3f5yz7N3L7j3fhfs953PufT5mdu4953t29j18Ls/97vf7Pd+TqkKS1KZDpj2AJOnAjLQkNcxIS1LDjLQkNcxIS1LDjLQkNayXSCc5Ksk1HV73gSQn9zGDJK0Fqx7pJIcDlwGHjnndC4GvVNVnVnsGSVor+tiTvhvYBuyGe/aqP5Lk2iQXjZ47Avhj4LYkZ/YwgyStCase6araXVW3L3nqIuA9VXUa8JwkRwIXAu8D/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hFut883KE1J8nHgPOq6pZlz5/A8OOXAH4D+Bfg06PHd1TVlyc3pdSNe9KaeUk2JFn67tl54CeWbD9kdKXAm4ETGd5M/k7gVuD40a+3TGpe6WD4tnCtBVuB149uxvN44EaAJUc9DgF+h2GYXwr8KPBd4GhgA8N7FH97siNL3Xi4Q2tKkmur6rQVtr8KOBP4Q+AOhvF+WVXdMaERpYNipLWmJPlf4CtLnvoR4OyqujHJI4EjgTOAVwE3A98HrgOurKovTnpeaRwPd2jNSHIs8O9VddaS5/6B4bFnGB7eeDTDDzR9BfA9hicOnwycluS/yr0WNcZIay15OcMb8Cx1JHsj/Xujr5sYnjy8i+FNe3YDDwCuAr7T95DSwTDSWhOSnAo8A/iZJc89FPjhqtrz6R7PAc4Bngn8NcOf/5OA64GrqspAqzlegqeZl+RRwBsZHnu+c/TcW4GdwCWjxycBlwG3V9WLGF7NcVtVvYzhsek3JzllGvNLK/HEodaEJBur6q5pzyGtNiMtSQ3zcIckNcxIS1LDjLQkNcxIS1LDjLQkNez/AW4/RUQq46MZAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "qw.plot(kind='bar');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案3'"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "qw.idxmax()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 　9.3.2 后悔期望值法及直观分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>畅销</th>\n",
       "      <th>一般</th>\n",
       "      <th>滞销</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>2600000</td>\n",
       "      <td>1400000</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>1300000</td>\n",
       "      <td>700000</td>\n",
       "      <td>275000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>550000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          畅销       一般      滞销\n",
       "方案                           \n",
       "方案1  2600000  1400000       0\n",
       "方案2  1300000   700000  275000\n",
       "方案3        0        0  550000"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Rm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "方案\n",
       "方案1    1170000.0\n",
       "方案2     653750.0\n",
       "方案3     137500.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "probE=[0.1,0.65,0.25]; \n",
    "hhqw=(probE*Rm).sum(1); hhqw"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iV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Cl/8/bjtW80uHw2/m1luwE3tB/Y6ZfAD4PsOBqy3HA79ML+MuAnwbuBh4JrKP3PtnfP7YjS914mUVrUpJ9VbVtmecvAc4B/hi4i17kX15Vdx2jEaXDYsy1JiX5DvCNBQ/9FPCcqvp8kkcDpwBPAy4BvgX8CLgZ+GBVfeVYzysN42UWrTlJNgP/XlXPXvDYR+hdG4feZZXH0fvhwK8EfkjvBdCnANuS/Fd5FqRVxphrLXoFvTdjWugU5mP+h/1fT6L3Iui99N7AaQ44HvgQ8IOjPaR0OIy51pQkZwPnAb+84LGHAj9RVff/xJrnAbuAZwJ/Q+//k9OBzwAfqipDrlXHWxO1ZiR5LHAlvWvj9/QfewdwI3BV/+PTgWuAO6vqhfTuXjlUVS+nd+38rUnOGsf80nJ8AVRrSpL1VXXvuOeQRs2YS1IDvMwiSQ0w5pLUAGMuSQ0w5pLUAGMuSQ34P6EBwQHEOKclAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "hhqw.plot(kind='bar');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'方案3'"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hhqw.idxmin()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>期望值</th>\n",
       "      <th>期望方案</th>\n",
       "      <th>后悔期望值</th>\n",
       "      <th>后悔期望方案</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>方案1</th>\n",
       "      <td>6630000.0</td>\n",
       "      <td>False</td>\n",
       "      <td>6630000.0</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案2</th>\n",
       "      <td>7146250.0</td>\n",
       "      <td>False</td>\n",
       "      <td>7146250.0</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>方案3</th>\n",
       "      <td>7662500.0</td>\n",
       "      <td>True</td>\n",
       "      <td>7662500.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           期望值   期望方案      后悔期望值  后悔期望方案\n",
       "方案                                      \n",
       "方案1  6630000.0  False  6630000.0   False\n",
       "方案2  7146250.0  False  7146250.0   False\n",
       "方案3  7662500.0   True  7662500.0    True"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.DataFrame({'期望值':qw,'期望方案':qw==qw.max(),\n",
    "              '后悔期望值':qw,'后悔期望方案':hhqw==hhqw.min()})"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
